'''
- 字符串（字符序列）和字节序列
    - 字符Unicode
    - 字节 字符的二进制表现形式
    -
    -
    - 码位与编码区别：(b')表二进制的意思
    + b = '您好'.encode("utf-8")
    + b'\xe6\x82\xa8\xe5\xa5\xbd'
    = b1 = '您好'.encode("utf-8") + '啊'.encode('gbk')
    + b1.decode("utf-8",errors='ignore')
    + b1.decode("utf-8",errors='replace')


- 字符串CURD操作
    create:
            a = 'ab'
            > 'ab'

    retrieve:

            a.find("a")
            > 0
            a.find("b")
            > 1
            a.find("c")
            > -1
            a.index("a")
            > 0
            a.index("c")
                Traceback (most recent call last):
                  File "<stdin>", line 1, in <module>
                ValueError: substring not found
    update:

            > a
            'ab'
            > a.replace("b","c")
            'ac'

            > a = "Python,Java,c++"
            > a.split(",")
            ['Python', 'Java', 'c++']
            > a
            'Python,Java,c++'
            > b = a.split(",")
            > b
            ['Python', 'Java', 'c++']
            >  a
            'Python,Java,c++'
            > ",".join(b)
            'Python,Java,c++'

    delete:

            > a = "    Java "
            > a
            '    Java '
            > a.strip()
            'Java'
        a.rstrip() #把右侧的空格都消掉
        a.lstrip() #把左侧的空格都消掉

- 练习字符串的格式化
         > a = "Python"
        > b = "learn"
        > print("I {0} {1}".format(a,b))
        I Python learn
        > print("I {0} {1}".format(b,a))
        I learn Python
        ·按传入参数默认顺序
        > print("I {} {}".format(b,a))
        I learn Python
        ·按指定参数索引
        > print("I {0} {1}".format(b,a))
        I learn Python
        >  print("I {0}{0} {1}".format(b,a))
        I learnlearn Python
        ·按关键词参数
         > print("I {a} {b}".format(a = 'am',b = 'studying'))
        I am studying
        按变量
         > print(f"I am learning: {a}, {b}")
        I am learning: Python, learn
        ·小数的表示
        > " "{:.3f}".format(3.1415926)
        '3.142'
        ·%
        > "learning %s %s" % ("Python", "Java")
        'learning Python Java'



'''

# 字符串

'''
output = open("output.txt","w",encoding="utf-8")
content = "Hello, Python"
# 正式写入文件
output.write(content)
# 关闭文件语句
output.close()
'''
input = open("output.txt","r",encoding="utf-8")
# 获取文件中的内容
content = input.read()
print(content)

